//一个非常简单的store的示例
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
	state: {
		isUpdate: false,
		loading: false,
		value: 0,
		duration: 1000
	},
	mutations: {
		notUpdate(state) {
			state.isUpdate = false
		},
		//tf作为主动控制的参数
		switch_loading(state, tf) {
			if (tf) {
				state.loading = tf.loading;
				state.value = tf.value;
				state.duration = tf.duration;
			} else {
				state.loading = !state.loading
			}
		}
	}
})
export default store
